/*     */ package com.zimbra.cs.index.query;
/*     */ 
/*     */ import com.zimbra.cs.index.DBQueryOperation;
/*     */ import com.zimbra.cs.index.QueryOperation;
/*     */ import com.zimbra.cs.mailbox.Mailbox;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public final class ModseqQuery
/*     */   extends Query
/*     */ {
/*     */   private final int modseq;
/*     */   private final Operator operator;
/*     */   
/*     */   static enum Operator
/*     */   {
/*  31 */     EQ,  GT,  GTEQ,  LT,  LTEQ;
/*     */     
/*     */     private Operator() {}
/*     */   }
/*     */   
/*     */   public ModseqQuery(String changeId)
/*     */   {
/*  38 */     if (changeId.charAt(0) == '<') {
/*  39 */       if (changeId.charAt(1) == '=') {
/*  40 */         this.operator = Operator.LTEQ;
/*  41 */         changeId = changeId.substring(2);
/*     */       } else {
/*  43 */         this.operator = Operator.LT;
/*  44 */         changeId = changeId.substring(1);
/*     */       }
/*  46 */     } else if (changeId.charAt(0) == '>') {
/*  47 */       if (changeId.charAt(1) == '=') {
/*  48 */         this.operator = Operator.GTEQ;
/*  49 */         changeId = changeId.substring(2);
/*     */       } else {
/*  51 */         this.operator = Operator.GT;
/*  52 */         changeId = changeId.substring(1);
/*     */       }
/*     */     } else {
/*  55 */       this.operator = Operator.EQ;
/*     */     }
/*  57 */     this.modseq = Integer.parseInt(changeId);
/*     */   }
/*     */   
/*     */   public boolean hasTextOperation()
/*     */   {
/*  62 */     return false;
/*     */   }
/*     */   
/*     */   public QueryOperation compile(Mailbox mbox, boolean bool)
/*     */   {
/*  67 */     DBQueryOperation op = new DBQueryOperation();
/*  68 */     long highest = -1L;
/*  69 */     long lowest = -1L;
/*  70 */     boolean lowestEq = false;
/*  71 */     boolean highestEq = false;
/*     */     
/*  73 */     switch (this.operator) {
/*     */     case EQ: 
/*  75 */       highest = this.modseq;
/*  76 */       lowest = this.modseq;
/*  77 */       highestEq = true;
/*  78 */       lowestEq = true;
/*  79 */       break;
/*     */     case GT: 
/*  81 */       lowest = this.modseq;
/*  82 */       break;
/*     */     case GTEQ: 
/*  84 */       lowest = this.modseq;
/*  85 */       lowestEq = true;
/*  86 */       break;
/*     */     case LT: 
/*  88 */       highest = this.modseq;
/*  89 */       break;
/*     */     case LTEQ: 
/*  91 */       highest = this.modseq;
/*  92 */       highestEq = true;
/*     */     }
/*     */     
/*     */     
/*  96 */     op.addModSeqRange(lowest, lowestEq, highest, highestEq, evalBool(bool));
/*  97 */     return op;
/*     */   }
/*     */   
/*     */   public void dump(StringBuilder out)
/*     */   {
/* 102 */     out.append("MODSEQ:");
/* 103 */     out.append(this.operator);
/* 104 */     out.append(this.modseq);
/*     */   }
/*     */   
/*     */   public void sanitizedDump(StringBuilder out)
/*     */   {
/* 109 */     out.append("MODSEQ:");
/* 110 */     out.append(this.operator);
/* 111 */     out.append("$NUM");
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/index/query/ModseqQuery.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */